package org.sais.exscanner;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

public class ScannerAlertReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		String action = intent.getAction();
		Uri data = intent.getData();
		if (!action.equals(Intent.ACTION_MEDIA_SCANNER_FINISHED) || data == null) {
			return;
		}

		Intent scan_intent = new Intent().setAction(ScanService.ACTION_SCAN_DIR).setData(data);
		context.startService(scan_intent);
	}

}
